<script setup>
import {pageofficeOpenFile} from "@/plugins/pageoffice/pageoffice-common.js";
import {auditApproved} from "@/api/document/processDocument.js";
import FlowInfoView from "@/views/document/process/processing/flowInfo/common/flowInfoView.vue";
import {setCurrentIsRefreshAdvice} from "@/utils/document.js";
import {refreshAdviceListFunction} from "@/utils/document-process.js";

const prop = defineProps({
  documentInfo: {
    type: Object
  },
  flowInfoButtons: {
    type: JSON
  },
  isRefreshAdvice: {
    type: Boolean
  }
})
const docId = prop.documentInfo.id
const currentIsRefreshAdvice = ref(prop.isRefreshAdvice)
const { refreshAdviceList } = refreshAdviceListFunction(currentIsRefreshAdvice)

function openApprovalFile() {
  pageofficeOpenFile('/document/processing/audit/openApprovalFile/' + docId, docId)
}

function openMainFile() {
  pageofficeOpenFile('/document/processing/common/openMainFile/' + docId, docId)
}

</script>

<template>
  <FlowInfoView :documentInfo="documentInfo" :isBack="flowInfoButtons.isBack" :isApproved="flowInfoButtons.isAudit" :approvedFunction="auditApproved"
                :isRefreshAdvice="currentIsRefreshAdvice">
    <template #default>
      <el-button type="primary" @click="openApprovalFile">打开呈批表</el-button>
      <el-button type="primary" @click="openMainFile">打开正文</el-button>
    </template>
  </FlowInfoView>
</template>

